
#ifndef  _RADIX_ARCHAISM_HEADER_H_
#define  _RADIX_ARCHAISM_HEADER_H_

/*
=================================================================
== Build Configurations
=================================================================
*/

#define _RADIX_REALPRECISION_SINGLE 1
#define _RADIX_REALPRECISION_DOUBLE 2

#define _RADIX_REALPRECISION _RADIX_REALPRECISION_DOUBLE

/*
=================================================================
== Compiler and CompilerVersion
=================================================================
*/
#define _RADIX_COMPILER_MSVC 1
#define _RADIX_COMPILER_GNUC 2

#if defined(_MSC_VER)
	#define _RADIX_COMPILER _RADIX_COMPILER_MSVC
	#define _RADIX_COMPILERVERSION _MSC_VER
#elif defined(__GNUC__)
	#define _RADIX_COMPILER _RADIX_COMPILER_GNUC
	#define _RADIX_COMPILERVERSION  \
		(((__GNUC__)*100) + ((__GNUC_MINOR__)*10) + (__GNUC_PATCHLEVEL__))
#endif

/*
=================================================================
== Platform
=================================================================
*/
#define _RADIX_PLATFORM_WIN32 1
#define _RADIX_PLATFORM_LINUX 2
#define _RADIX_PLATFORM_APPLE 3
#define _RADIX_PLATFORM_IPHONE 4
#define _RADIX_PLATFORM_ANDROID 5
#define _RADIX_PLATFORM_SYMBIAN 6

#if defined(__WIN32__) || defined(_WIN32)
	#define _RADIX_PLATFORM _RADIX_PLATFORM_WIN32
#elif defined(__APPLE_CC__)
	#if (__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 30000 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 30000)
		#define _RADIX_PLATFORM _RADIX_PLATFORM_IPHONE
	#else
		#define _RADIX_PLATFORM _RADIX_PLATFORM_APPLE
	#endif
#elif defined(__ANDROID__)
	#define _RADIX_PLATFORM _RADIX_PLATFORM_ANDROID
#elif defined(__SYMBIAN32__)
	#define _RADIX_PLATFORM _RADIX_PLATFORM_SYMBIAsN
#else
	#define _RADIX_PLATFORM _RADIX_PLATFORM_LINUX
#endif

/*
=================================================================
== StringType and Unicode
=================================================================
*/
#define _RADIX_STRINGTYPE_MBS 1
#define _RADIX_STRINGTYPE_WCS 2

#if _RADIX_COMPILER == _RADIX_COMPILER_MSVC
	#if defined(_UNICODE)
		#define _RADIX_STRINGTYPE _RADIX_STRINGTYPE_WCS
	#else
		#define _RADIX_STRINGTYPE _RADIX_STRINGTYPE_MBS
	#endif
#else
	#define _RADIX_STRINGTYPE _RADIX_STRINGTYPE_MBS 
#endif

#define _RADIX_UCS_2 2
#define _RADIX_UCS_4 4

#if(_RADIX_PLATFORM == _RADIX_PLATFORM_WIN32)
	#define _RADIX_UCS _RADIX_UCS_2
#elif(_RADIX_PLATFORM == _RADIX_PLATFORM_LINUX)
	#define _RADIX_UCS _RADIX_UCS_4
#endif

/*
=================================================================
== Universal macros
=================================================================
*/
#if (_RADIX_COMPILER == _RADIX_COMPILER_MSVC)
	#pragma warning(disable: 4996) // do not tell me to use "_s" functions.
#endif

#if (_RADIX_COMPILER == _RADIX_COMPILER_MSVC)
	#if (_RADIX_COMPILERVERSION < 1600)
		#define nullptr NULL
	#endif
#endif

#if (_RADIX_COMPILER == _RADIX_COMPILER_MSVC)
	#ifndef _RADIX_API_EXPORT
		#define _RadixApi __declspec(dllimport)
	#else
		#define _RadixApi __declspec(dllexport)
	#endif//_RadixApi
#else
	#define _RadixApi
#endif

/*
=================================================================
== Frequently used types and macros
=================================================================
*/
#ifndef _BeginNamespace
#define _BeginNamespace(ns) namespace ns {
#endif//_BeginNamespace

#ifndef _EndNamespace
#define _EndNamespace(ns) }
#endif//_EndNamespace

#ifndef _TokenToStr
#define _TokenToStr(token) (#token)
#endif//_TokenToStr

#ifndef _CombineToken
#define _CombineToken(token1, token2) (token1##token2)
#endif//_CombineToken

#ifndef _CountOfArray
#define _CountOfArray(a) (sizeof(a)/sizeof(a[0]))
#endif//_CountOfArray

#ifndef _BitMask
#define _BitMask(n) (1<<(n))
#endif//_BitMask
#ifndef _BitFlag
#define _BitFlag(value, n) ((value)&_BitMask(n))
#endif//_BitFlag
#ifndef _ReverseBit
#define _ReverseBit(value, n) ((value)^_BitMask(n))
#endif//_ReverseBit
#ifndef _SetBit
#define _SetBit(value, n) ((value)|_BitMask(n))
#endif//_SetBit
#ifndef _ClearBit
#define _ClearBit(value, n) (_BitFlag(value, n) != 0 ? ReverseBit(value, n) : (value)) 
#endif//_ClearBit

#ifndef _TestReturn
#define _TestReturn(expr, value, ret) if((expr)==(value)){return (ret);}
#endif//_TestReturn

#ifndef _ForbidCopy
#define _ForbidCopy(className) \
	private: \
	className(const className&)
#endif//_ForbidCopy

#ifndef _ForbidAssign
#define _ForbidAssign(className) \
	private: \
	className& operator=(const className&)
#endif//_ForbidAssign


#include <string>

_BeginNamespace(Radix)

typedef unsigned char uchar;
typedef wchar_t wchar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef long long longlong;
typedef unsigned long long ulonglong;
typedef long double longdouble;

#if(_RADIX_REALPRECISION == _RADIX_REALPRECISION_SINGLE)
	typedef float real;
	#ifndef _RealEqual
		#define _RealEqual(a, b) ((a)>=(b)?((a)-(b)<=0.000001):((b)-(a)<=0.000001))
	#endif//_RealEqual
#else
	typedef double real;
	#ifndef _RealEqual
		#define _RealEqual(a, b) ((a)>=(b)?((a)-(b)<=0.000000000001):((b)-(a)<=0.000000000001))
	#endif//_RealEqual
#endif

#if(_RADIX_STRINGTYPE == _RADIX_STRINGTYPE_MBS)
	typedef std::string String;
	#ifndef _T	
		#define _T(cstr) (cstr)
	#endif//_T
	#ifndef _ToStr
		#define _ToStr(token) _T(_TokenToStr(token))
	#endif//_ToStr
#else
	typedef std::wstring String;
	#ifndef _T	
		#define _T(cstr) (_CombineToken(L, cstr))
	#endif//_T
	#ifndef _ToStr
		#define _ToStr(token) _T(_TokenToStr(token))
	#endif//_ToStr
#endif//(_RADIX_STRINGTYPE == _RADIX_STRINGTYPE_MBS)

class Interface
{
public:
	virtual ~Interface(){}
};

_EndNamespace(Radix)

#endif//_RADIX_ARCHAISM_HEADER_H_
